<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<include file="Public:meta" />
</head>
<body id="main_page">
<include file="Public:position" />
<div class="container">
    <form enctype="multipart/form-data"  method="post" id="frm">
        <input type="hidden" name="NowPage" id="NowPage" value="{$NowPage}" />
        <div class="table">
            <div class="toolbars">
                <li class="toolbar"><a id="btnCache" onclick="DelAll()"  title="删除所有">删除所有记录</a></li>
                <li class="toolbar"><a id="selectall" onclick="CheckAll()"  title="全选">全选</a></li>
                <li class="toolbar"><a id="del" onclick="BatchDel()" title="批量删除">删除</a></li>
                <li class="toolbar"><a id="btnSave" onclick="saveAll()"  title="保存所有票数">保存所有票数</a></li>
                <li class="toolbar toolbarform">
                    <label>票号</label><input type="text" class='textinput' name="Keywords" style="width:120px" value="{$Keywords}" id="Keywords"/>
                    <input id="btnSeek" class="btnToolbarForm" type="submit" value="查询" onclick="Search()">
                </li>
            </div>
            <table class="datatable" id="datatable">
                <tr>
                    <th width="45px" >选中</th>
                    <th width="70px">序号</th>
                    <th width="120px" >票号</th>
                    <th  width="120px">票数</th>
                    <th style="text-align:left; padding-left:45px">参选时间</th>
                </tr>  
                <notempty name="Message">                
                    <volist name="Message" id="v">
                        <tr>
                            <td><input class="checkrow" type="checkbox" name="VoteID[]" value="{$v.VoteID}" /></td>
                             <td style="color:#00F">{$i}</td>
                            <td>{$v.VoteNumber}</td>
                            <td>
                            <input type="text" class='textinput' onclick="this.select()" style="width:100px" name="VoteCount[]" value="{$v.VoteCount}" />
                            <input type="hidden" class='textinput' name="VoteID1[]" value="{$v.VoteID}" />
                            </td>
                            <td  style="text-align:left; padding-left:15px">{$v.VoteTime|strtotime|yd_friend_date}</td>
                        </tr>
                    </volist>
                <else/>
                    <tr><td colspan="5" id="NoData">{$Think.lang.NoDataTip}</td></tr>
                </notempty>                                
            </table>
             <div class="tfoot">
                  <div class="page"><span class="pagesize">每页<span class="pz">{$AdminPageSize}</span>条</span>{$Page}</div>
             </div>
        </div>
   </form>
</div>
</body>
</html>
<script type="text/javascript">
//批量删除
function BatchDel(){
	//var arrChk = $("input[name='InfoID[]'][checked]"); //在高速浏览器长度总是返回0
	var arrChk = $("input[name='VoteID[]']");
	var n = 0;
	for(var i = 0; i < arrChk.length; i++){
		if(arrChk[i].checked) n++;
	}
	
	if( n == 0 ) {
		WarnBox("{$Think.lang.CheckDeleteTip}");
		return;
	}
	
	$.confirm("{$Think.lang.DeleteTip}", function () {
		$('#frm').attr("action", "__URL__/batchDelToupiao");
		$('#frm').submit();
	}, function () {
		return true;
	});
}

	//查询
function Search(){
	$('#frm').attr("action", "__URL__/toupiao");
	$('#frm').submit();
	return true;
}	

	//保存所有修改
function saveAll(){
	$.confirm("<div id='icon_common'>确定保存所有票数吗?</div>", function () {
		$('#frm').attr("action", "{$Url}batchSaveCount");
		$('#frm').submit();
	}, function () {
		return true;
	});
}	

//查询
function DelAll(){
	$.confirm("<div id='icon_common'>确定删除所有数据吗?</div>", function () {
		location.href = "__URL__/delAllToupiao";
	}, function () {
		return true;
	});
}

//提示信息
$(document).ready(function(){
	//选中操作
	$("#Keywords").focus();
});
</script>